<template>
  <div>
    <div v-if="!$store.state.isbusNewsDitle">
      <div class="staffHomeCulture">
        <div
          v-for="item in sheyingList"
          :key="item.id"
          class="culture_box pointer"
          @click="handDetil()"
        >
          <div class="cul_img_box">
            <img
              class="cul_img"
              :src="item.img"
            >
          </div>

          <div class="cul_conter_box">
            <p class="cul_title">{{item.title}}</p>
            <p class="cul_contert">{{item.dp}}</p>
          </div>
        </div>
      </div>
      <div
        class="page_box"
        style="margin-top: 70px;margin-bottom:30px;"
      >
        <el-pagination
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :page-sizes="[5,10,15]"
          :page-size="pageBid3.limit"
          layout="total, prev, pager, next, jumper"
          :total="pageBid3.totalCount"
        >
        </el-pagination>
      </div>
    </div>
    <transition name="fade">
      <staffHomeCultureDitle v-if="$store.state.isbusNewsDitle"></staffHomeCultureDitle>
    </transition>

  </div>
</template>

<script>
import staffHomeCultureDitle from "./staffHomeCultureDitle";
export default {
  name: "staffHomeCulture.vue",
  components: {
    staffHomeCultureDitle
  },
  props: {
    cultureList: {
      type: Array
    },
    sonid: {
      type: Number
    }
  },
  watch: {
    cultureList(newList, oldList) {}
  },
  data() {
    return {
      sheyingList: [],
      pageBid3: {
        start: 1,
        limit: 10,
        totalCount: 0,
        tatalpage: 0
      }
    };
  },
  mounted() {
    console.log(this.sonid, "idddd");
    this.$api.getList({ sortId: this.sonid, page: 1, limit: 6 }).then(res => {
      console.log(res.data.data, "职工活动");
      this.sheyingList = res.data.data;
      this.pageBid3.totalCount = res.data.count;
      this.sheyingList.forEach(item => {
        item.img = item.img.replace(/\\/g, "/");
        item.img = this.$store.state.baseUrl + item.img;
      });
    });
  },
  methods: {
    init(page) {
      this.$api
        .getList({ sortId: this.sonid, page: page, limit: 6 })
        .then(res => {
          this.sheyingList = res.data.data;
          this.sheyingList.forEach(item => {
            item.img = item.img.replace(/\\/g, "/");
            item.img = this.$store.state.baseUrl + item.img;
          });
        });
    },
    handDetil() {
      this.$store.commit("handBus", true);
    },
    handleSizeChange() {},
    handleCurrentChange(val) {
      this.init(val);
    }
  }
};
</script>

<style lang='scss' scoped>
.staffHomeCulture {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding-left: 20px;
  padding-right: 20px;
}
.culture_box {
  margin-bottom: 40px;
  display: flex;
  padding: 1px;
  .cul_img_box {
    border: 1px dashed #ccc;
    text-align: center;
    .cul_img {
      width: 120px;
      height: 166px;
    }
  }
  .cul_conter_box {
    margin-left: 23px;
    .cul_contert {
      margin-top: 8px;
      width: 111px;
      color: #333333;
      font-size: 12px;
      letter-spacing: 0.8px;
      line-height: 20px;
      text-indent: 28px;
    }
  }
}
</style>
